home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / MacWindows.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  38.2 KB  |  1,059 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        MacWindows.h
  3.  
  4.      Contains:    Window Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MACWINDOWS__
  19. #define __MACWINDOWS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __ALIASES__
  25. #include <Aliases.h>
  26. #endif
  27. #ifndef __APPLEEVENTS__
  28. #include <AppleEvents.h>
  29. #endif
  30. #ifndef __COLLECTIONS__
  31. #include <Collections.h>
  32. #endif
  33. #ifndef __DRAG__
  34. #include <Drag.h>
  35. #endif
  36. #ifndef __EVENTS__
  37. #include <Events.h>
  38. #endif
  39. #ifndef __MENUS__
  40. #include <Menus.h>
  41. #endif
  42. #ifndef __MIXEDMODE__
  43. #include <MixedMode.h>
  44. #endif
  45. #ifndef __QDOFFSCREEN__
  46. #include <QDOffscreen.h>
  47. #endif
  48. #ifndef __QUICKDRAW__
  49. #include <Quickdraw.h>
  50. #endif
  51. #ifndef __TEXTCOMMON__
  52. #include <TextCommon.h>
  53. #endif
  54.  
  55.  
  56.  
  57. #if PRAGMA_ONCE
  58. #pragma once
  59. #endif
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65. #if PRAGMA_IMPORT
  66. #pragma import on
  67. #endif
  68.  
  69. #if PRAGMA_STRUCT_ALIGN
  70.     #pragma options align=mac68k
  71. #elif PRAGMA_STRUCT_PACKPUSH
  72.     #pragma pack(push, 2)
  73. #elif PRAGMA_STRUCT_PACK
  74.     #pragma pack(2)
  75. #endif
  76.  
  77. /*——————————————————————————————————————————————————————————————————————————————————————*/
  78. /* • Window Definition Type                                                                */
  79. /*——————————————————————————————————————————————————————————————————————————————————————*/
  80.  
  81. enum {
  82.     kWindowDefProcType            = FOUR_CHAR_CODE('WDEF')
  83. };
  84.  
  85. /*——————————————————————————————————————————————————————————————————————————————————————*/
  86. /* • System 7.5 Window Definition Resource IDs                                            */
  87. /*——————————————————————————————————————————————————————————————————————————————————————*/
  88.  
  89. enum {
  90.     kStandardWindowDefinition    = 0,                            /* for document windows and dialogs*/
  91.     kRoundWindowDefinition        = 1,                            /* old da-style window*/
  92.     kFloatingWindowDefinition    = 124                            /* for floating windows*/
  93. };
  94.  
  95. /*——————————————————————————————————————————————————————————————————————————————————————*/
  96. /* • Variant Codes                                                                        */
  97. /*——————————————————————————————————————————————————————————————————————————————————————*/
  98.  
  99. enum {
  100.                                                                 /* for use with kStandardWindowDefinition */
  101.     kDocumentWindowVariantCode    = 0,
  102.     kModalDialogVariantCode        = 1,
  103.     kPlainDialogVariantCode        = 2,
  104.     kShadowDialogVariantCode    = 3,
  105.     kMovableModalDialogVariantCode = 5,
  106.     kAlertVariantCode            = 7,
  107.     kMovableAlertVariantCode    = 9,                            /* for use with kFloatingWindowDefinition */
  108.     kSideFloaterVariantCode        = 8
  109. };
  110.  
  111.  
  112. /*——————————————————————————————————————————————————————————————————————————————————————*/
  113. /* • DefProc IDs                                                                        */
  114. /*——————————————————————————————————————————————————————————————————————————————————————*/
  115.  
  116. enum {
  117.                                                                 /* classic ids */
  118.     documentProc                = 0,
  119.     dBoxProc                    = 1,
  120.     plainDBox                    = 2,
  121.     altDBoxProc                    = 3,
  122.     noGrowDocProc                = 4,
  123.     movableDBoxProc                = 5,
  124.     zoomDocProc                    = 8,
  125.     zoomNoGrow                    = 12,
  126.     rDocProc                    = 16,                            /* floating window defproc ids */
  127.     floatProc                    = 1985,
  128.     floatGrowProc                = 1987,
  129.     floatZoomProc                = 1989,
  130.     floatZoomGrowProc            = 1991,
  131.     floatSideProc                = 1993,
  132.     floatSideGrowProc            = 1995,
  133.     floatSideZoomProc            = 1997,
  134.     floatSideZoomGrowProc        = 1999
  135. };
  136.  
  137.  
  138. enum {
  139.                                                                 /* Resource IDs for theme-savvy window defprocs */
  140.     kWindowDocumentDefProcResID    = 64,
  141.     kWindowDialogDefProcResID    = 65,
  142.     kWindowUtilityDefProcResID    = 66,
  143.     kWindowUtilitySideTitleDefProcResID = 67
  144. };
  145.  
  146.  
  147. enum {
  148.                                                                 /* Proc IDs for theme-savvy windows */
  149.     kWindowDocumentProc            = 1024,
  150.     kWindowGrowDocumentProc        = 1025,
  151.     kWindowVertZoomDocumentProc    = 1026,
  152.     kWindowVertZoomGrowDocumentProc = 1027,
  153.     kWindowHorizZoomDocumentProc = 1028,
  154.     kWindowHorizZoomGrowDocumentProc = 1029,
  155.     kWindowFullZoomDocumentProc    = 1030,
  156.     kWindowFullZoomGrowDocumentProc = 1031
  157. };
  158.  
  159.  
  160. enum {
  161.                                                                 /* Proc IDs for theme-savvy dialogs */
  162.     kWindowPlainDialogProc        = 1040,
  163.     kWindowShadowDialogProc        = 1041,
  164.     kWindowModalDialogProc        = 1042,
  165.     kWindowMovableModalDialogProc = 1043,
  166.     kWindowAlertProc            = 1044,
  167.     kWindowMovableAlertProc        = 1045
  168. };
  169.  
  170. /* procIDs available in Appearance 1.0.1 or later */
  171.  
  172. enum {
  173.     kWindowMovableModalGrowProc    = 1046
  174. };
  175.  
  176.  
  177. enum {
  178.                                                                 /* Proc IDs for top title bar theme-savvy floating windows */
  179.     kWindowFloatProc            = 1057,
  180.     kWindowFloatGrowProc        = 1059,
  181.     kWindowFloatVertZoomProc    = 1061,
  182.     kWindowFloatVertZoomGrowProc = 1063,
  183.     kWindowFloatHorizZoomProc    = 1065,
  184.     kWindowFloatHorizZoomGrowProc = 1067,
  185.     kWindowFloatFullZoomProc    = 1069,
  186.     kWindowFloatFullZoomGrowProc = 1071
  187. };
  188.  
  189.  
  190.  
  191. enum {
  192.                                                                 /* Proc IDs for side title bar theme-savvy floating windows */
  193.     kWindowFloatSideProc        = 1073,
  194.     kWindowFloatSideGrowProc    = 1075,
  195.     kWindowFloatSideVertZoomProc = 1077,
  196.     kWindowFloatSideVertZoomGrowProc = 1079,
  197.     kWindowFloatSideHorizZoomProc = 1081,
  198.     kWindowFloatSideHorizZoomGrowProc = 1083,
  199.     kWindowFloatSideFullZoomProc = 1085,
  200.     kWindowFloatSideFullZoomGrowProc = 1087
  201. };
  202.  
  203. /*——————————————————————————————————————————————————————————————————————————————————————*/
  204. /* • System 7 Window Positioning Constants                                                */
  205. /*                                                                                        */
  206. /* Passed into StandardAlert and used in ‘WIND’, ‘DLOG’, and ‘ALRT’ templates            */
  207. /* StandardAlert uses zero to specify the default position. Other calls use zero to        */
  208. /* specify “no position”.  Do not pass these constants to RepositionWindow.  Do not        */
  209. /* store these constants in the BasicWindowDescription of a ‘wind’ resource.            */
  210. /*——————————————————————————————————————————————————————————————————————————————————————*/
  211.  
  212.  
  213. enum {
  214.     kWindowNoPosition            = 0x0000,
  215.     kWindowDefaultPosition        = 0x0000,
  216.     kWindowCenterMainScreen        = 0x280A,
  217.     kWindowAlertPositionMainScreen = 0x300A,
  218.     kWindowStaggerMainScreen    = 0x380A,
  219.     kWindowCenterParentWindow    = 0xA80A,
  220.     kWindowAlertPositionParentWindow = 0xB00A,
  221.     kWindowStaggerParentWindow    = 0xB80A,
  222.     kWindowCenterParentWindowScreen = 0x680A,
  223.     kWindowAlertPositionParentWindowScreen = 0x700A,
  224.     kWindowStaggerParentWindowScreen = 0x780A
  225. };
  226.  
  227. /*——————————————————————————————————————————————————————————————————————————————————————*/
  228. /* • GetWindowRegion Types                                                                */
  229. /*——————————————————————————————————————————————————————————————————————————————————————*/
  230.  
  231.  
  232. enum {
  233.                                                                 /* Region values to pass into GetWindowRegion */
  234.     kWindowTitleBarRgn            = 0,
  235.     kWindowTitleTextRgn            = 1,
  236.     kWindowCloseBoxRgn            = 2,
  237.     kWindowZoomBoxRgn            = 3,
  238.     kWindowDragRgn                = 5,
  239.     kWindowGrowRgn                = 6,
  240.     kWindowCollapseBoxRgn        = 7,
  241.     kWindowStructureRgn            = 32,
  242.     kWindowContentRgn            = 33
  243. };
  244.  
  245. typedef UInt16                             WindowRegionCode;
  246. /* GetWindowRegionRec - used for WDEF calls with kWindowMsgGetRegion */
  247.  
  248. struct GetWindowRegionRec {
  249.     RgnHandle                         winRgn;
  250.     WindowRegionCode                 regionCode;
  251. };
  252. typedef struct GetWindowRegionRec        GetWindowRegionRec;
  253.  
  254. typedef GetWindowRegionRec *            GetWindowRegionPtr;
  255.  
  256. /*——————————————————————————————————————————————————————————————————————————————————————*/
  257. /* • Standard Window Kinds                                                                */
  258. /*——————————————————————————————————————————————————————————————————————————————————————*/
  259.  
  260. enum {
  261.     dialogKind                    = 2,
  262.     userKind                    = 8,
  263.     kDialogWindowKind            = 2,
  264.     kApplicationWindowKind        = 8
  265. };
  266.  
  267.  
  268. /*——————————————————————————————————————————————————————————————————————————————————————*/
  269. /* • FindWindow Result Codes                                                            */
  270. /*——————————————————————————————————————————————————————————————————————————————————————*/
  271.  
  272. enum {
  273.     inDesk                        = 0,
  274.     inNoWindow                    = 0,
  275.     inMenuBar                    = 1,
  276.     inSysWindow                    = 2,
  277.     inContent                    = 3,
  278.     inDrag                        = 4,
  279.     inGrow                        = 5,
  280.     inGoAway                    = 6,
  281.     inZoomIn                    = 7,
  282.     inZoomOut                    = 8,
  283.     inCollapseBox                = 11
  284. };
  285.  
  286. /*——————————————————————————————————————————————————————————————————————————————————————*/
  287. /* • Window Definition Hit Test Result Codes                                            */
  288. /*——————————————————————————————————————————————————————————————————————————————————————*/
  289.  
  290. enum {
  291.     wNoHit                        = 0,
  292.     wInContent                    = 1,
  293.     wInDrag                        = 2,
  294.     wInGrow                        = 3,
  295.     wInGoAway                    = 4,
  296.     wInZoomIn                    = 5,
  297.     wInZoomOut                    = 6,
  298.     wInCollapseBox                = 9
  299. };
  300.  
  301. /*——————————————————————————————————————————————————————————————————————————————————————*/
  302. /* • Window Definition Messages                                                            */
  303. /*——————————————————————————————————————————————————————————————————————————————————————*/
  304.  
  305.  
  306. enum {
  307.     kWindowMsgDraw                = 0,
  308.     kWindowMsgHitTest            = 1,
  309.     kWindowMsgCalculateShape    = 2,
  310.     kWindowMsgInitialize        = 3,
  311.     kWindowMsgCleanUp            = 4,
  312.     kWindowMsgDrawGrowOutline    = 5,
  313.     kWindowMsgDrawGrowBox        = 6,
  314.     kWindowMsgGetFeatures        = 7,
  315.     kWindowMsgGetRegion            = 8,                            /* old names*/
  316.     wDraw                        = 0,
  317.     wHit                        = 1,
  318.     wCalcRgns                    = 2,
  319.     wNew                        = 3,
  320.     wDispose                    = 4,
  321.     wGrow                        = 5,
  322.     wDrawGIcon                    = 6
  323. };
  324.  
  325.  
  326. /*——————————————————————————————————————————————————————————————————————————————————————*/
  327. /* • Window Feature Bits                                                                */
  328. /*——————————————————————————————————————————————————————————————————————————————————————*/
  329.  
  330. enum {
  331.     kWindowCanGrow                = (1 << 0),
  332.     kWindowCanZoom                = (1 << 1),
  333.     kWindowCanCollapse            = (1 << 2),
  334.     kWindowIsModal                = (1 << 3),
  335.     kWindowCanGetWindowRegion    = (1 << 4),
  336.     kWindowIsAlert                = (1 << 5),
  337.     kWindowHasTitleBar            = (1 << 6)
  338. };
  339.  
  340.  
  341. /*——————————————————————————————————————————————————————————————————————————————————————*/
  342. /* • Desktop Pattern Resource ID                                                        */
  343. /*——————————————————————————————————————————————————————————————————————————————————————*/
  344.  
  345. enum {
  346.     deskPatID                    = 16
  347. };
  348.  
  349.  
  350.  
  351. /*——————————————————————————————————————————————————————————————————————————————————————*/
  352. /* • Window Color Part Codes                                                            */
  353. /*——————————————————————————————————————————————————————————————————————————————————————*/
  354.  
  355. enum {
  356.     wContentColor                = 0,
  357.     wFrameColor                    = 1,
  358.     wTextColor                    = 2,
  359.     wHiliteColor                = 3,
  360.     wTitleBarColor                = 4
  361. };
  362.  
  363.  
  364. /*——————————————————————————————————————————————————————————————————————————————————————*/
  365. /*    • Region Dragging Constants
  366. |*——————————————————————————————————————————————————————————————————————————————————————*/
  367.  
  368.  
  369. enum {
  370.     kMouseUpOutOfSlop            = (long)0x80008000
  371. };
  372.  
  373.  
  374. /*——————————————————————————————————————————————————————————————————————————————————————*/
  375. /* • Window Color Table                                                                    */
  376. /*——————————————————————————————————————————————————————————————————————————————————————*/
  377.  
  378. struct WinCTab {
  379.     long                             wCSeed;                        /* reserved */
  380.     short                             wCReserved;                    /* reserved */
  381.     short                             ctSize;                        /* usually 4 for windows */
  382.     ColorSpec                         ctTable[5];
  383. };
  384. typedef struct WinCTab                    WinCTab;
  385.  
  386. typedef WinCTab *                        WCTabPtr;
  387. typedef WCTabPtr *                        WCTabHandle;
  388. /*——————————————————————————————————————————————————————————————————————————————————————*/
  389. /* • WindowRecord                                                                        */
  390. /*——————————————————————————————————————————————————————————————————————————————————————*/
  391. typedef struct WindowRecord             WindowRecord;
  392. typedef WindowRecord *                    WindowPeek;
  393.  
  394. struct WindowRecord {
  395.     GrafPort                         port;
  396.     short                             windowKind;
  397.     Boolean                         visible;
  398.     Boolean                         hilited;
  399.     Boolean                         goAwayFlag;
  400.     Boolean                         spareFlag;
  401.     RgnHandle                         strucRgn;
  402.     RgnHandle                         contRgn;
  403.     RgnHandle                         updateRgn;
  404.     Handle                             windowDefProc;
  405.     Handle                             dataHandle;
  406.     StringHandle                     titleHandle;
  407.     short                             titleWidth;
  408.     Handle                             controlList;
  409.     WindowPeek                         nextWindow;
  410.     PicHandle                         windowPic;
  411.     long                             refCon;
  412. };
  413.  
  414. /*——————————————————————————————————————————————————————————————————————————————————————*/
  415. /* • Color WindowRecord                                                                    */
  416. /*——————————————————————————————————————————————————————————————————————————————————————*/
  417. typedef struct CWindowRecord             CWindowRecord;
  418. typedef CWindowRecord *                    CWindowPeek;
  419.  
  420. struct CWindowRecord {
  421.     CGrafPort                         port;
  422.     short                             windowKind;
  423.     Boolean                         visible;
  424.     Boolean                         hilited;
  425.     Boolean                         goAwayFlag;
  426.     Boolean                         spareFlag;
  427.     RgnHandle                         strucRgn;
  428.     RgnHandle                         contRgn;
  429.     RgnHandle                         updateRgn;
  430.     Handle                             windowDefProc;
  431.     Handle                             dataHandle;
  432.     StringHandle                     titleHandle;
  433.     short                             titleWidth;
  434.     Handle                             controlList;
  435.     CWindowPeek                     nextWindow;
  436.     PicHandle                         windowPic;
  437.     long                             refCon;
  438. };
  439.  
  440. /*——————————————————————————————————————————————————————————————————————————————————————*/
  441. /* • AuxWinHandle                                                                        */
  442. /*——————————————————————————————————————————————————————————————————————————————————————*/
  443. typedef struct AuxWinRec                 AuxWinRec;
  444. typedef AuxWinRec *                        AuxWinPtr;
  445. typedef AuxWinPtr *                        AuxWinHandle;
  446.  
  447. struct AuxWinRec {
  448.     AuxWinHandle                     awNext;                        /*handle to next AuxWinRec*/
  449.     WindowPtr                         awOwner;                    /*ptr to window */
  450.     CTabHandle                         awCTable;                    /*color table for this window*/
  451.     Handle                             reserved;
  452.     long                             awFlags;                    /*reserved for expansion*/
  453.     CTabHandle                         awReserved;                    /*reserved for expansion*/
  454.     long                             awRefCon;                    /*user Constant*/
  455. };
  456.  
  457. /*——————————————————————————————————————————————————————————————————————————————————————*/
  458. /* • Window Class Ordering                                                                */
  459. /*                                                                                        */
  460. /*    Special cases for the “behind” parameter in window creation calls.                    */
  461. /*——————————————————————————————————————————————————————————————————————————————————————*/
  462. #ifndef __cplusplus
  463.  
  464. enum {
  465.     kFirstWindowOfClass            = (-1),
  466.     kLastWindowOfClass            = 0
  467. };
  468.  
  469. #else
  470. const WindowPtr        kFirstWindowOfClass            = (WindowPtr) -1;
  471. const WindowPtr        kLastWindowOfClass            = (WindowPtr) 0L;
  472. #endif  /*  ! defined(__cplusplus)  */
  473.  
  474. /*——————————————————————————————————————————————————————————————————————————————————————*/
  475. /* • Zoom Information Handle                                                             */
  476. /*——————————————————————————————————————————————————————————————————————————————————————*/
  477.  
  478. struct WStateData {
  479.     Rect                             userState;                    /*user zoom state*/
  480.     Rect                             stdState;                    /*standard zoom state*/
  481. };
  482. typedef struct WStateData                WStateData;
  483. typedef WStateData *                    WStateDataPtr;
  484. typedef WStateDataPtr *                    WStateDataHandle;
  485. /*——————————————————————————————————————————————————————————————————————————————————————*/
  486. /* • Window Creation & Persistence                                                        */
  487. /*——————————————————————————————————————————————————————————————————————————————————————*/
  488.  
  489. EXTERN_API( WindowPtr )
  490. GetNewCWindow                    (short                     windowID,
  491.                                  void *                    wStorage,
  492.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xAA46);
  493.  
  494. EXTERN_API( WindowPtr )
  495. NewWindow                        (void *                    wStorage,
  496.                                  const Rect *            boundsRect,
  497.                                  ConstStr255Param         title,
  498.                                  Boolean                 visible,
  499.                                  short                     theProc,
  500.                                  WindowPtr                 behind,
  501.                                  Boolean                 goAwayFlag,
  502.                                  long                     refCon)                                ONEWORDINLINE(0xA913);
  503.  
  504. EXTERN_API( WindowPtr )
  505. GetNewWindow                    (short                     windowID,
  506.                                  void *                    wStorage,
  507.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA9BD);
  508.  
  509. EXTERN_API( WindowPtr )
  510. NewCWindow                        (void *                    wStorage,
  511.                                  const Rect *            boundsRect,
  512.                                  ConstStr255Param         title,
  513.                                  Boolean                 visible,
  514.                                  short                     procID,
  515.                                  WindowPtr                 behind,
  516.                                  Boolean                 goAwayFlag,
  517.                                  long                     refCon)                                ONEWORDINLINE(0xAA45);
  518.  
  519. EXTERN_API( void )
  520. DisposeWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA914);
  521.  
  522. #if TARGET_OS_MAC
  523.     #define MacCloseWindow CloseWindow
  524. #endif
  525. EXTERN_API( void )
  526. MacCloseWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92D);
  527.  
  528.  
  529.  
  530.  
  531. /*——————————————————————————————————————————————————————————————————————————————————————*/
  532. /* • Background Imaging                                                                    */
  533. /*——————————————————————————————————————————————————————————————————————————————————————*/
  534. EXTERN_API( void )
  535. SetWinColor                        (WindowPtr                 theWindow,
  536.                                  WCTabHandle             newColorTable)                        ONEWORDINLINE(0xAA41);
  537.  
  538. EXTERN_API( void )
  539. SetDeskCPat                        (PixPatHandle             deskPixPat)                            ONEWORDINLINE(0xAA47);
  540.  
  541.  
  542.  
  543.  
  544. /*——————————————————————————————————————————————————————————————————————————————————————*/
  545. /* • Low-Level Region & Painting Routines                                                */
  546. /*——————————————————————————————————————————————————————————————————————————————————————*/
  547. EXTERN_API( void )
  548. ClipAbove                        (WindowPtr                 window)                                ONEWORDINLINE(0xA90B);
  549.  
  550. EXTERN_API( void )
  551. SaveOld                            (WindowPtr                 window)                                ONEWORDINLINE(0xA90E);
  552.  
  553. EXTERN_API( void )
  554. DrawNew                            (WindowPtr                 window,
  555.                                  Boolean                 update)                                ONEWORDINLINE(0xA90F);
  556.  
  557. EXTERN_API( void )
  558. PaintOne                        (WindowPtr                 window,
  559.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90C);
  560.  
  561. EXTERN_API( void )
  562. PaintBehind                        (WindowPtr                 startWindow,
  563.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90D);
  564.  
  565. EXTERN_API( void )
  566. CalcVis                            (WindowPtr                 window)                                ONEWORDINLINE(0xA909);
  567.  
  568. EXTERN_API( void )
  569. CalcVisBehind                    (WindowPtr                 startWindow,
  570.                                  RgnHandle                 clobberedRgn)                        ONEWORDINLINE(0xA90A);
  571.  
  572. EXTERN_API( Boolean )
  573. CheckUpdate                        (EventRecord *            theEvent)                            ONEWORDINLINE(0xA911);
  574.  
  575. /*——————————————————————————————————————————————————————————————————————————————————————*/
  576. /* • Window List                                                                        */
  577. /*——————————————————————————————————————————————————————————————————————————————————————*/
  578. #if TARGET_OS_MAC
  579.     #define MacFindWindow FindWindow
  580. #endif
  581. EXTERN_API( short )
  582. MacFindWindow                    (Point                     thePoint,
  583.                                  WindowPtr *            theWindow)                            ONEWORDINLINE(0xA92C);
  584.  
  585. EXTERN_API( WindowPtr )
  586. FrontWindow                        (void)                                                        ONEWORDINLINE(0xA924);
  587.  
  588. EXTERN_API( void )
  589. BringToFront                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA920);
  590.  
  591. EXTERN_API( void )
  592. SendBehind                        (WindowPtr                 theWindow,
  593.                                  WindowPtr                 behindWindow)                        ONEWORDINLINE(0xA921);
  594.  
  595. EXTERN_API( void )
  596. SelectWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA91F);
  597.  
  598.  
  599. /*——————————————————————————————————————————————————————————————————————————————————————*/
  600. /* • Misc Low-Level stuff                                                                            */
  601. /*——————————————————————————————————————————————————————————————————————————————————————*/
  602. EXTERN_API( void )
  603. InitWindows                        (void)                                                        ONEWORDINLINE(0xA912);
  604.  
  605. EXTERN_API( void )
  606. GetWMgrPort                        (GrafPtr *                wPort)                                ONEWORDINLINE(0xA910);
  607.  
  608. EXTERN_API( void )
  609. GetCWMgrPort                    (CGrafPtr *                wMgrCPort)                            ONEWORDINLINE(0xAA48);
  610.  
  611.  
  612.  
  613. /*——————————————————————————————————————————————————————————————————————————————————————*/
  614. /* • Various & Sundry Window Accessors                                                            */
  615. /*——————————————————————————————————————————————————————————————————————————————————————*/
  616. EXTERN_API( void )
  617. HiliteWindow                    (WindowPtr                 theWindow,
  618.                                  Boolean                 fHilite)                            ONEWORDINLINE(0xA91C);
  619.  
  620. EXTERN_API( OSStatus )
  621. GetWindowFeatures                (WindowPtr                 inWindow,
  622.                                  UInt32 *                outFeatures)                        THREEWORDINLINE(0x303C, 0x0013, 0xAA74);
  623.  
  624. EXTERN_API( OSStatus )
  625. GetWindowRegion                    (WindowPtr                 inWindow,
  626.                                  WindowRegionCode         inRegionCode,
  627.                                  RgnHandle                 ioWinRgn)                            THREEWORDINLINE(0x303C, 0x0014, 0xAA74);
  628.  
  629. EXTERN_API( void )
  630. SetWRefCon                        (WindowPtr                 theWindow,
  631.                                  long                     data)                                ONEWORDINLINE(0xA918);
  632.  
  633. EXTERN_API( long )
  634. GetWRefCon                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA917);
  635.  
  636. EXTERN_API( void )
  637. SetWindowPic                    (WindowPtr                 theWindow,
  638.                                  PicHandle                 pic)                                ONEWORDINLINE(0xA92E);
  639.  
  640. EXTERN_API( PicHandle )
  641. GetWindowPic                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA92F);
  642.  
  643. EXTERN_API( short )
  644. GetWVariant                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA80A);
  645.  
  646. /*——————————————————————————————————————————————————————————————————————————————————————*/
  647. /* • Update Events                                                                        */
  648. /*——————————————————————————————————————————————————————————————————————————————————————*/
  649. EXTERN_API( void )
  650. InvalRect                        (const Rect *            badRect)                            ONEWORDINLINE(0xA928);
  651.  
  652. EXTERN_API( void )
  653. InvalRgn                        (RgnHandle                 badRgn)                                ONEWORDINLINE(0xA927);
  654.  
  655. EXTERN_API( void )
  656. ValidRect                        (const Rect *            goodRect)                            ONEWORDINLINE(0xA92A);
  657.  
  658. EXTERN_API( void )
  659. ValidRgn                        (RgnHandle                 goodRgn)                            ONEWORDINLINE(0xA929);
  660.  
  661. EXTERN_API( void )
  662. BeginUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA922);
  663.  
  664. EXTERN_API( void )
  665. EndUpdate                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA923);
  666.  
  667.  
  668. /*——————————————————————————————————————————————————————————————————————————————————————*/
  669. /* • DrawGrowIcon                                                                        */
  670. /*                                                                                        */
  671. /*    With the advent of Appearance, DrawGrowIcon is obsolete.  From Appearance 1.0        */
  672. /*    onward, the system WDEF automagically draws the grow icon for growable window        */
  673. /*    procIDs.                                                                            */
  674. /*——————————————————————————————————————————————————————————————————————————————————————*/
  675. EXTERN_API( void )
  676. DrawGrowIcon                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA904);
  677.  
  678.  
  679. /*——————————————————————————————————————————————————————————————————————————————————————*/
  680. /* • Window Titles & Document Support                                                    */
  681. /*——————————————————————————————————————————————————————————————————————————————————————*/
  682. EXTERN_API( void )
  683. SetWTitle                        (WindowPtr                 theWindow,
  684.                                  ConstStr255Param         title)                                ONEWORDINLINE(0xA91A);
  685.  
  686. EXTERN_API( void )
  687. GetWTitle                        (WindowPtr                 theWindow,
  688.                                  Str255                 title)                                ONEWORDINLINE(0xA919);
  689.  
  690.  
  691.  
  692. /*——————————————————————————————————————————————————————————————————————————————————————*/
  693. /* • Window Positioning                                                                    */
  694. /*——————————————————————————————————————————————————————————————————————————————————————*/
  695. EXTERN_API( Boolean )
  696. IsWindowCollapsable                (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x000F, 0xAA74);
  697.  
  698. EXTERN_API( Boolean )
  699. IsWindowCollapsed                (WindowPtr                 inWindow)                            THREEWORDINLINE(0x303C, 0x0010, 0xAA74);
  700.  
  701. EXTERN_API( OSStatus )
  702. CollapseWindow                    (WindowPtr                 inWindow,
  703.                                  Boolean                 inCollapseIt)                        THREEWORDINLINE(0x303C, 0x0011, 0xAA74);
  704.  
  705. EXTERN_API( OSStatus )
  706. CollapseAllWindows                (Boolean                 inCollapseEm)                        THREEWORDINLINE(0x303C, 0x0012, 0xAA74);
  707.  
  708. #if TARGET_OS_MAC
  709.     #define MacMoveWindow MoveWindow
  710. #endif
  711. EXTERN_API( void )
  712. MacMoveWindow                    (WindowPtr                 theWindow,
  713.                                  short                     hGlobal,
  714.                                  short                     vGlobal,
  715.                                  Boolean                 front)                                ONEWORDINLINE(0xA91B);
  716.  
  717. EXTERN_API( void )
  718. SizeWindow                        (WindowPtr                 theWindow,
  719.                                  short                     w,
  720.                                  short                     h,
  721.                                  Boolean                 fUpdate)                            ONEWORDINLINE(0xA91D);
  722.  
  723.  
  724. EXTERN_API( void )
  725. ZoomWindow                        (WindowPtr                 theWindow,
  726.                                  short                     partCode,
  727.                                  Boolean                 front)                                ONEWORDINLINE(0xA83A);
  728.  
  729. EXTERN_API( long )
  730. GrowWindow                        (WindowPtr                 theWindow,
  731.                                  Point                     startPt,
  732.                                  const Rect *            bBox)                                ONEWORDINLINE(0xA92B);
  733.  
  734. EXTERN_API( void )
  735. DragWindow                        (WindowPtr                 theWindow,
  736.                                  Point                     startPt,
  737.                                  const Rect *            boundsRect)                            ONEWORDINLINE(0xA925);
  738.  
  739.  
  740. /*——————————————————————————————————————————————————————————————————————————————————————*/
  741. /* • Window Visibility                                                                    */
  742. /*——————————————————————————————————————————————————————————————————————————————————————*/
  743.  
  744. EXTERN_API( void )
  745. HideWindow                        (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA916);
  746.  
  747. #if TARGET_OS_MAC
  748.     #define MacShowWindow ShowWindow
  749. #endif
  750. EXTERN_API( void )
  751. MacShowWindow                    (WindowPtr                 theWindow)                            ONEWORDINLINE(0xA915);
  752.  
  753. EXTERN_API( void )
  754. ShowHide                        (WindowPtr                 theWindow,
  755.                                  Boolean                 showFlag)                            ONEWORDINLINE(0xA908);
  756.  
  757.  
  758. /*——————————————————————————————————————————————————————————————————————————————————————*/
  759. /* • Utilities                                                                            */
  760. /*——————————————————————————————————————————————————————————————————————————————————————*/
  761. EXTERN_API( long )
  762. PinRect                            (const Rect *            theRect,
  763.                                  Point                     thePt)                                ONEWORDINLINE(0xA94E);
  764.  
  765.  
  766. EXTERN_API( RgnHandle )
  767. GetGrayRgn                        (void)                                                        TWOWORDINLINE(0x2EB8, 0x09EE);
  768.  
  769.  
  770. /*——————————————————————————————————————————————————————————————————————————————————————*/
  771. /* • Window Part Tracking                                                                */
  772. /*——————————————————————————————————————————————————————————————————————————————————————*/
  773. EXTERN_API( Boolean )
  774. TrackBox                        (WindowPtr                 theWindow,
  775.                                  Point                     thePt,
  776.                                  short                     partCode)                            ONEWORDINLINE(0xA83B);
  777.  
  778. EXTERN_API( Boolean )
  779. TrackGoAway                        (WindowPtr                 theWindow,
  780.                                  Point                     thePt)                                ONEWORDINLINE(0xA91E);
  781.  
  782.  
  783. /*——————————————————————————————————————————————————————————————————————————————————————*/
  784. /* • Region Dragging                                                                    */
  785. /*——————————————————————————————————————————————————————————————————————————————————————*/
  786. EXTERN_API( long )
  787. DragGrayRgn                        (RgnHandle                 theRgn,
  788.                                  Point                     startPt,
  789.                                  const Rect *            limitRect,
  790.                                  const Rect *            slopRect,
  791.                                  short                     axis,
  792.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA905);
  793.  
  794. EXTERN_API( long )
  795. DragTheRgn                        (RgnHandle                 theRgn,
  796.                                  Point                     startPt,
  797.                                  const Rect *            limitRect,
  798.                                  const Rect *            slopRect,
  799.                                  short                     axis,
  800.                                  DragGrayRgnUPP         actionProc)                            ONEWORDINLINE(0xA926);
  801.  
  802.  
  803. /*——————————————————————————————————————————————————————————————————————————————————————*/
  804. /*    • GetAuxWin                                                                            */
  805. /*                                                                                        */
  806. /*    Avoid using GetAuxWin if at all possible                                            */
  807. /*——————————————————————————————————————————————————————————————————————————————————————*/
  808. EXTERN_API( Boolean )
  809. GetAuxWin                        (WindowPtr                 theWindow,
  810.                                  AuxWinHandle *            awHndl)                                ONEWORDINLINE(0xAA42);
  811.  
  812.  
  813. /*——————————————————————————————————————————————————————————————————————————————————————*/
  814. /* • MixedMode & ProcPtrs                                                                */
  815. /*——————————————————————————————————————————————————————————————————————————————————————*/
  816. typedef CALLBACK_API( long , WindowDefProcPtr )(short varCode, WindowPtr theWindow, short message, long param);
  817. typedef CALLBACK_API( void , DeskHookProcPtr )(Boolean mouseClick, EventRecord *theEvent);
  818. /*
  819.     WARNING: DeskHookProcPtr uses register based parameters under classic 68k
  820.              and cannot be written in a high-level language without 
  821.              the help of mixed mode or assembly glue.
  822. */
  823. typedef STACK_UPP_TYPE(WindowDefProcPtr)                         WindowDefUPP;
  824. typedef REGISTER_UPP_TYPE(DeskHookProcPtr)                         DeskHookUPP;
  825. enum { uppWindowDefProcInfo = 0x00003BB0 };                     /* pascal 4_bytes Func(2_bytes, 4_bytes, 2_bytes, 4_bytes) */
  826. enum { uppDeskHookProcInfo = 0x00130802 };                         /* register no_return_value Func(1_byte:D0, 4_bytes:A0) */
  827. #define NewWindowDefProc(userRoutine)                             (WindowDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppWindowDefProcInfo, GetCurrentArchitecture())
  828. #define NewDeskHookProc(userRoutine)                             (DeskHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeskHookProcInfo, GetCurrentArchitecture())
  829. #define CallWindowDefProc(userRoutine, varCode, theWindow, message, param)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppWindowDefProcInfo, (varCode), (theWindow), (message), (param))
  830. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  831.     #pragma parameter CallDeskHookProc(__A1, __D0, __A0)
  832.     void CallDeskHookProc(DeskHookUPP routine, Boolean mouseClick, EventRecord * theEvent) = 0x4E91;
  833. #else
  834.     #define CallDeskHookProc(userRoutine, mouseClick, theEvent)  CALL_TWO_PARAMETER_UPP((userRoutine), uppDeskHookProcInfo, (mouseClick), (theEvent))
  835. #endif
  836. /*——————————————————————————————————————————————————————————————————————————————————————*/
  837. /* • C Glue                                                                                */
  838. /*——————————————————————————————————————————————————————————————————————————————————————*/
  839. #if CGLUESUPPORTED
  840. EXTERN_API_C( void )
  841. setwtitle                        (WindowPtr                 theWindow,
  842.                                  const char *            title);
  843.  
  844. EXTERN_API_C( Boolean )
  845. trackgoaway                        (WindowPtr                 theWindow,
  846.                                  Point *                thePt);
  847.  
  848. EXTERN_API_C( short )
  849. findwindow                        (Point *                thePoint,
  850.                                  WindowPtr *            theWindow);
  851.  
  852. EXTERN_API_C( void )
  853. getwtitle                        (WindowPtr                 theWindow,
  854.                                  char *                    title);
  855.  
  856. EXTERN_API_C( long )
  857. growwindow                        (WindowPtr                 theWindow,
  858.                                  Point *                startPt,
  859.                                  const Rect *            bBox);
  860.  
  861. EXTERN_API_C( WindowPtr )
  862. newwindow                        (void *                    wStorage,
  863.                                  const Rect *            boundsRect,
  864.                                  const char *            title,
  865.                                  Boolean                 visible,
  866.                                  short                     theProc,
  867.                                  WindowPtr                 behind,
  868.                                  Boolean                 goAwayFlag,
  869.                                  long                     refCon);
  870.  
  871. EXTERN_API_C( WindowPtr )
  872. newcwindow                        (void *                    wStorage,
  873.                                  const Rect *            boundsRect,
  874.                                  const char *            title,
  875.                                  Boolean                 visible,
  876.                                  short                     procID,
  877.                                  WindowPtr                 behind,
  878.                                  Boolean                 goAwayFlag,
  879.                                  long                     refCon);
  880.  
  881. EXTERN_API_C( long )
  882. pinrect                            (const Rect *            theRect,
  883.                                  Point *                thePt);
  884.  
  885. EXTERN_API_C( Boolean )
  886. trackbox                        (WindowPtr                 theWindow,
  887.                                  Point *                thePt,
  888.                                  short                     partCode);
  889.  
  890. EXTERN_API_C( long )
  891. draggrayrgn                        (RgnHandle                 theRgn,
  892.                                  Point *                startPt,
  893.                                  const Rect *            boundsRect,
  894.                                  const Rect *            slopRect,
  895.                                  short                     axis,
  896.                                  DragGrayRgnUPP         actionProc);
  897.  
  898. EXTERN_API_C( void )
  899. dragwindow                        (WindowPtr                 theWindow,
  900.                                  Point *                startPt,
  901.                                  const Rect *            boundsRect);
  902.  
  903. #endif  /* CGLUESUPPORTED */
  904.  
  905. /*——————————————————————————————————————————————————————————————————————————————————————*/
  906. /* • WindowRecord accessor macros                                                        */
  907. /*——————————————————————————————————————————————————————————————————————————————————————*/
  908. /*
  909.     *****************************************************************************
  910.     *                                                                           *
  911.     * The conditional STRICT_WINDOWS has been removed from this interface file. *
  912.     * The accessor macros to a WindowRecord are no longer necessary.            *
  913.     *                                                                           *
  914.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  915.     *                                                                           *
  916.     *****************************************************************************
  917.  
  918.     Details:
  919.     The original purpose of the STRICT_ conditionals and accessor macros was to
  920.     help ease the transition to Copland.  Shared data structures are difficult
  921.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  922.     WindowRecord and other data structures, we would begin the migration to the
  923.     discipline wherein system data structures are completely hidden from
  924.     applications.
  925.     
  926.     After many design reviews, we finally concluded that with this sort of
  927.     migration, the system could never tell when an application was no longer
  928.     peeking at a WindowRecord, and thus the data structure might never become
  929.     system owned.  Additionally, there were many other limitations in the
  930.     classic toolbox that were begging to be addressed.  The final decision was
  931.     to leave the traditional toolbox as a compatibility mode.
  932.     
  933.     We also decided to use the Handle and Ptr based types in the function
  934.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  935.     WindowRef.  The Ref types are still defined in the header files, so all
  936.     existing code will still compile exactly as it did before.  There are
  937.     several reasons why we chose to do this:
  938.     
  939.     - The importance of backwards compatibility makes it unfeasible for us to
  940.     enforce real opaque references in the implementation anytime in the
  941.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  942.     ControlRef, etc.) in the documentation and header files would always be a
  943.     fake veneer of opacity.
  944.     
  945.     - There exists a significant base of books and sample code that neophyte
  946.     Macintosh developers use to learn how to program the Macintosh.  These
  947.     books and sample code all use direct data access.  Introducing opaque data
  948.     types at this point would confuse neophyte programmers more than it would
  949.     help them.
  950.     
  951.     - Direct data structure access is used by nearly all Macintosh developers. 
  952.     Changing the interfaces to reflect a false opacity would not provide any
  953.     benefit to these developers.
  954.     
  955.     - Accessor functions are useful in and of themselves as convenience
  956.     functions.
  957.     
  958.     - Note: some accessor names conflict with API's in Win32 and have been renamed
  959.     to have a Mac prefix (QuickTime 3.0).
  960. */
  961. #ifdef __cplusplus
  962. inline CGrafPtr        GetWindowPort(WindowPtr w)                     { return (CGrafPtr) w;                                                     }
  963. inline void            SetPortWindowPort(WindowPtr w)                { MacSetPort( (GrafPtr) GetWindowPort(w)); }
  964. inline SInt16        GetWindowKind(WindowPtr w)                     { return ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)));             }
  965. inline void            SetWindowKind(WindowPtr    w, SInt16 wKind)    { *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind;              }
  966. #if TARGET_OS_MAC
  967. inline Boolean        IsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  968. #endif
  969. inline Boolean        MacIsWindowVisible(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2);         }
  970. inline Boolean        IsWindowHilited(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3);        }
  971. inline Boolean        GetWindowGoAwayFlag(WindowPtr w)            { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4);        }
  972. inline Boolean        GetWindowZoomFlag(WindowPtr w)                { return *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5);        }
  973. inline void            GetWindowStructureRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), r );    }
  974. inline void            GetWindowContentRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), r );    }
  975. inline void            GetWindowUpdateRgn(WindowPtr w, RgnHandle r)    { MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), r );    }
  976. inline SInt16        GetWindowTitleWidth(WindowPtr w)                { return *(SInt16 *)(((UInt8 *) w) + sizeof(GrafPort) + 0x1E);            }
  977. #if TARGET_OS_MAC
  978. inline WindowPtr    GetNextWindow(WindowPtr w)                        { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  979. #endif
  980. inline WindowPtr    MacGetNextWindow(WindowPtr w)                    { return *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24);        }
  981.  
  982. inline void    GetWindowStandardState(WindowPtr w, Rect *r)
  983. {    Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  984. if (stateRects != NULL)    *r = stateRects[1];        }
  985. inline void    SetWindowStandardState(WindowPtr w, const Rect *r)
  986. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  987.     if (stateRects != NULL)    stateRects[1] = *r;     }
  988. inline void    GetWindowUserState(WindowPtr w, Rect *r)
  989. {     Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  990.     if (stateRects != NULL)    *r = stateRects[0]; }
  991. inline void    SetWindowUserState(WindowPtr w, const Rect *r)
  992. { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));
  993.     if (stateRects != NULL)    stateRects[0] = *r; }
  994. inline Handle        GetWindowDataHandle(WindowPtr w)                {    return    (((WindowPeek) (w))->dataHandle);                }
  995. inline void            SetWindowDataHandle(WindowPtr w, Handle data)    {    (((WindowPeek) (w))->dataHandle) = ((Handle) (data));    }
  996. #else
  997. #if TARGET_OS_MAC
  998. #define IsWindowVisible MacIsWindowVisible
  999. #define GetNextWindow MacGetNextWindow
  1000. #endif
  1001. #define ShowHideWindow(w)                        ShowHide(w)
  1002. #define SetPortWindowPort(w)                    MacSetPort( (GrafPtr) GetWindowPort(w) )
  1003. #define GetWindowPort(w)                        ( (CGrafPtr) w)
  1004. #define GetWindowKind(w)                        ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)))
  1005. #define SetWindowKind(w, wKind)                    ( *(SInt16 *)    (((UInt8 *) w) + sizeof(GrafPort)) = wKind )
  1006. #define MacIsWindowVisible(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x2))
  1007. #define IsWindowHilited(w)                        ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x3))
  1008. #define GetWindowGoAwayFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x4))
  1009. #define GetWindowZoomFlag(w)                    ( *(Boolean *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x5))
  1010. #define GetWindowStructureRgn(w, aRgnHandle)    MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0x6), aRgnHandle )
  1011. #define GetWindowContentRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xA), aRgnHandle )
  1012.  
  1013. #define GetWindowUpdateRgn(w, aRgnHandle)        MacCopyRgn( *(RgnHandle *)(((UInt8 *) w) + sizeof(GrafPort) + 0xE), aRgnHandle )
  1014.  
  1015. #define GetWindowTitleWidth(w)                    ( *(SInt16 *)        (((UInt8 *) w) + sizeof(GrafPort) + 0x1E))
  1016. #define MacGetNextWindow(w)                        ( *(WindowPtr *)    (((UInt8 *) w) + sizeof(GrafPort) + 0x24))
  1017.  
  1018. #define GetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1019.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[1]; } while (false)
  1020. #define SetWindowStandardState(w, aRectPtr)    do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1021.                                                                 if (stateRects != NULL)    stateRects[1] = *aRectPtr; } while (false)
  1022. #define GetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1023.                                                                 if (stateRects != NULL)    *aRectPtr = stateRects[0]; } while (false)
  1024. #define SetWindowUserState(w, aRectPtr)        do { Rect *stateRects = (  (Rect *) (**(Handle *) (((UInt8 *) w) + sizeof(GrafPort) + 0x16)));    \
  1025.                                                                 if (stateRects != NULL)    stateRects[0] = *aRectPtr; } while (false)
  1026. #define GetWindowDataHandle(windowRef)                (((WindowPeek) (windowRef))->dataHandle)
  1027. #define SetWindowDataHandle(windowRef, data)        (((WindowPeek) (windowRef))->dataHandle) = ((Handle) (data))
  1028.  
  1029. #endif  /*  defined(__cplusplus)  */
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039. #if PRAGMA_STRUCT_ALIGN
  1040.     #pragma options align=reset
  1041. #elif PRAGMA_STRUCT_PACKPUSH
  1042.     #pragma pack(pop)
  1043. #elif PRAGMA_STRUCT_PACK
  1044.     #pragma pack()
  1045. #endif
  1046.  
  1047. #ifdef PRAGMA_IMPORT_OFF
  1048. #pragma import off
  1049. #elif PRAGMA_IMPORT
  1050. #pragma import reset
  1051. #endif
  1052.  
  1053. #ifdef __cplusplus
  1054. }
  1055. #endif
  1056.  
  1057. #endif /* __MACWINDOWS__ */
  1058.  
  1059.